
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gummworld2.state</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="gummworld2.html"><font color="#ffffff">gummworld2</font></a>.state</strong></big></big> (version $Id: state.py 407 2013-08-12 15:11:30Z stabbingfinger@gmail.com $)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/cygwin/home/bw/devel/python/svn/gummworld2_devel/gamelib/gummworld2/state.py">c:\cygwin\home\bw\devel\python\svn\gummworld2_devel\gamelib\gummworld2\state.py</a></font></td></tr></table>
    <p><tt>state.py&nbsp;-&nbsp;A&nbsp;class&nbsp;for&nbsp;convenient&nbsp;global&nbsp;access&nbsp;to&nbsp;Gummworld2<br>
run-time&nbsp;objects.<br>
&nbsp;<br>
The&nbsp;<a href="#State">State</a>&nbsp;class&nbsp;has&nbsp;class&nbsp;variables&nbsp;to&nbsp;hold&nbsp;the&nbsp;core&nbsp;library&nbsp;objects.&nbsp;It&nbsp;also<br>
has&nbsp;save()&nbsp;and&nbsp;restore()&nbsp;static&nbsp;methods&nbsp;to&nbsp;manage&nbsp;context&nbsp;switching.<br>
&nbsp;<br>
Programmers&nbsp;may&nbsp;place&nbsp;ad&nbsp;hoc&nbsp;attributes&nbsp;in&nbsp;this&nbsp;class,&nbsp;and&nbsp;leverage&nbsp;the&nbsp;save()<br>
and&nbsp;restore()&nbsp;methods&nbsp;for&nbsp;their&nbsp;own&nbsp;use.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gummworld2.state.html#State">State</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="State">class <strong>State</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>state.<a href="#State">State</a><br>
&nbsp;<br>
The&nbsp;<a href="#State">State</a>&nbsp;class&nbsp;stores&nbsp;runtime&nbsp;objects&nbsp;and&nbsp;settings&nbsp;for&nbsp;easy&nbsp;global&nbsp;access.<br>
It&nbsp;is&nbsp;not&nbsp;intended&nbsp;to&nbsp;be&nbsp;instantiated.<br>
&nbsp;<br>
Descriptions&nbsp;of&nbsp;class&nbsp;attributes:<br>
&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;current&nbsp;state&nbsp;context.&nbsp;This&nbsp;can&nbsp;be&nbsp;any&nbsp;immutable<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value.&nbsp;Initial&nbsp;value&nbsp;is&nbsp;'init',&nbsp;and&nbsp;the&nbsp;state&nbsp;is&nbsp;saved&nbsp;so&nbsp;that&nbsp;<a href="#State">State</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;can&nbsp;be&nbsp;reset&nbsp;via&nbsp;<a href="#State">State</a>.<a href="#State-restore">restore</a>('init').<br>
&nbsp;&nbsp;&nbsp;&nbsp;screen:&nbsp;A&nbsp;Screen&nbsp;<a href="__builtin__.html#object">object</a>,&nbsp;which&nbsp;is&nbsp;a&nbsp;wrapper&nbsp;for&nbsp;the&nbsp;top&nbsp;level<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pygame&nbsp;surface.<br>
&nbsp;&nbsp;&nbsp;&nbsp;world:&nbsp;A&nbsp;model.World*&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;used&nbsp;to&nbsp;store&nbsp;game&nbsp;model&nbsp;entities.<br>
&nbsp;&nbsp;&nbsp;&nbsp;world_type:&nbsp;engine.NO_WORLD&nbsp;or&nbsp;engine.SIMPLE_WORLD&nbsp;if&nbsp;<a href="#State">State</a>&nbsp;was<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initialized&nbsp;via&nbsp;the&nbsp;Engine&nbsp;class.&nbsp;Else&nbsp;it&nbsp;is&nbsp;None.<br>
&nbsp;&nbsp;&nbsp;&nbsp;camera:&nbsp;A&nbsp;Camera&nbsp;<a href="__builtin__.html#object">object</a>.<br>
&nbsp;&nbsp;&nbsp;&nbsp;map:&nbsp;A&nbsp;BasicMap,&nbsp;TiledMap,&nbsp;or&nbsp;SuperMap&nbsp;<a href="__builtin__.html#object">object</a>.<br>
&nbsp;<br>
Class&nbsp;variable&nbsp;<a href="#State">State</a>.default_attrs&nbsp;holds&nbsp;the&nbsp;list&nbsp;of&nbsp;attributes&nbsp;that&nbsp;are<br>
saved&nbsp;and&nbsp;restored&nbsp;by&nbsp;default&nbsp;when&nbsp;the&nbsp;static&nbsp;methods&nbsp;<a href="#State">State</a>.<a href="#State-save">save</a>()&nbsp;and<br>
<a href="#State">State</a>.<a href="#State-restore">restore</a>()&nbsp;are&nbsp;called.&nbsp;Modify&nbsp;default_attrs&nbsp;as&nbsp;desired.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Static methods defined here:<br>
<dl><dt><a name="State-restore"><strong>restore</strong></a>(name, attrs<font color="#909090">=['world', 'world_type', 'map', 'camera']</font>)</dt><dd><tt>state.<a href="#State-restore">restore</a>()&nbsp;-&nbsp;restore&nbsp;a&nbsp;state&nbsp;context&nbsp;by&nbsp;name<br>
&nbsp;<br>
<a href="#State">State</a>.name&nbsp;is&nbsp;set&nbsp;to&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;name&nbsp;argument.<br>
&nbsp;<br>
The&nbsp;attrs&nbsp;argument&nbsp;is&nbsp;a&nbsp;sequence&nbsp;of&nbsp;strings&nbsp;naming&nbsp;the&nbsp;<a href="#State">State</a>&nbsp;attributes<br>
to&nbsp;restore.&nbsp;If&nbsp;attrs&nbsp;is&nbsp;not&nbsp;specified&nbsp;then&nbsp;<a href="#State">State</a>.default_attrs&nbsp;is&nbsp;used.<br>
&nbsp;<br>
If&nbsp;an&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;that&nbsp;is&nbsp;being&nbsp;restored&nbsp;has&nbsp;state_restored()&nbsp;method&nbsp;it&nbsp;will<br>
be&nbsp;called.&nbsp;The&nbsp;method&nbsp;is&nbsp;intended&nbsp;to&nbsp;sync&nbsp;the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;other&nbsp;parts&nbsp;of<br>
the&nbsp;game&nbsp;that&nbsp;may&nbsp;have&nbsp;updated&nbsp;while&nbsp;it&nbsp;was&nbsp;swapped&nbsp;out.</tt></dd></dl>

<dl><dt><a name="State-save"><strong>save</strong></a>(name, attrs<font color="#909090">=['world', 'world_type', 'map', 'camera']</font>)</dt><dd><tt>state.<a href="#State-save">save</a>()&nbsp;-&nbsp;save&nbsp;a&nbsp;state&nbsp;context&nbsp;by&nbsp;name<br>
&nbsp;<br>
The&nbsp;attrs&nbsp;argument&nbsp;is&nbsp;a&nbsp;sequence&nbsp;of&nbsp;strings&nbsp;naming&nbsp;the&nbsp;<a href="#State">State</a>&nbsp;attributes<br>
to&nbsp;save.&nbsp;If&nbsp;attrs&nbsp;is&nbsp;not&nbsp;specified&nbsp;then&nbsp;<a href="#State">State</a>.default_attrs&nbsp;is&nbsp;used.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>camera</strong> = None</dl>

<dl><dt><strong>camera_target</strong> = None</dl>

<dl><dt><strong>clock</strong> = None</dl>

<dl><dt><strong>default_attrs</strong> = ['world', 'world_type', 'map', 'camera']</dl>

<dl><dt><strong>init_attrs</strong> = ['screen', 'world', 'world_type', 'camera', 'map', 'clock', 'menu', 'running', 'speed', 'dt', 'show_grid', 'show_labels']</dl>

<dl><dt><strong>map</strong> = None</dl>

<dl><dt><strong>menu</strong> = None</dl>

<dl><dt><strong>name</strong> = 'init'</dl>

<dl><dt><strong>screen</strong> = None</dl>

<dl><dt><strong>show_grid</strong> = False</dl>

<dl><dt><strong>show_labels</strong> = False</dl>

<dl><dt><strong>speed</strong> = 4</dl>

<dl><dt><strong>world</strong> = None</dl>

<dl><dt><strong>world_type</strong> = None</dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__author__</strong> = 'Gummbum, (c) 2011-2013'<br>
<strong>__version__</strong> = '$Id: state.py 407 2013-08-12 15:11:30Z stabbingfinger@gmail.com $'<br>
<strong>states</strong> = {'init': {'camera': None, 'clock': None, 'map': None, 'menu': None, 'screen': None, 'show_grid': False, 'show_labels': False, 'speed': 4, 'world': None, 'world_type': None}}</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Gummbum,&nbsp;(c)&nbsp;2011-2013</td></tr></table>
</body></html>